package com.neusoft.dao;

import com.neusoft.model.User;

import java.sql.SQLException;
import java.util.List;

public interface UserDao {
    /**
     * 登录
     * @param username
     * @param password
     * @return User
     * select * from user where username = ? and password = ?
     */
    public User login(String username, String password);

    /**
     * 注册
     * @param user
     * @return boolean
     * insert into user(username,password) values(?,?)
     */
    public boolean register(User user) throws SQLException;

    /**
     * 查询所有用户信息
     * @return
     * select * from user
     */
    public List<User> getUsers();

    /**
     * 根据id查询某个用户
     * @param id
     * @return
     * select * from user where id = ?
     */
    public User findUserById(int id);

    /**
     * 修改某个用户
     * @param user
     * @return
     * update user set username=?,password=? where id = ?
     */
    public boolean updateUser(User user) throws SQLException;

    /**
     * 根据id删除某个用户
     * @param id
     * @return
     * delete from user where id = ?
     */
    public boolean deleteUser(int id)throws SQLException;

}
